
import * as ActionTypes from '../../../constants/constants.js'
import * as util from '../../../util/utils.js'

// 商家id
// export const user = (state = null) => {
//     return state;
// }
// [RNSplashScreen show];


export const purchasingGood = (state = [], action) => {
    switch (action.type) {
        case ActionTypes.purchasingGood:
            return action.data
        case ActionTypes.purchasingGoodRefresh:
            return action.data
        case ActionTypes.purchasingGoodError:
            state.error = action.data.error
            return {
                ...state,
                ...action.data
            }
        case ActionTypes.purchasingGoodReset:
            return []
        default:
            return state;
    }
}



// export const purchasingGood = (state = {
//     pageNum: 0,
//     nextPage: 1,
//     pageSize: 10,
//     list: []
// }, action) => {
//     switch (action.type) {
//         case ActionTypes.purchasingGood:
//             action.data.pageSize = 10
//             action.data.list = state.list.concat(action.data.list)
//             return action.data
//         case ActionTypes.purchasingGoodRefresh:
//             return action.data
//         case ActionTypes.purchasingGoodError:
//             state.error = action.data.error
//             return {
//                 ...state,
//                 ...action.data
//             }
//         case ActionTypes.purchasingGoodReset:
//             return {
//                 pageNum: 0,
//                 nextPage: 1,
//                 pageSize: 10,
//                 list: []
//             }
//         default:
//             return state;
//     }
// }
